Skip to content

Conversation

bryantbiggs
Copy link
Member

@bryantbiggs bryantbiggs commented Sep 15, 2025

Description

  • Support EKS Auto Mode custom node pools only creation
  • Raise min supported of AWS provider version to ensure users are not caught off guard when disabling built-in node pools r/aws_eks_cluster: Supports null compute_config.node_role_arn when disabling auto mode or built-in node pools hashicorp/terraform-provider-aws#42483
  • EKS auto mode compute_config default value changed to {} to use variable optional attribute defaults and set nullable = false. The API seems to now support creating clusters with compute_config.enabled = false/storage_config.block_storage.enabled = false/kubernetes_network_config.elastic_load_balancing.enabled = false which was not supported at launch for Auto Mode. This simplifies the configuration to where its either true or false; changing the default and disabling null simplifies the value checking (less thing != null or catching errors with a try() because it could be null)

Motivation and Context

Breaking Changes

  • No; backwards compat is maintained

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@bryantbiggs bryantbiggs force-pushed the feat/custom-node-pools branch from 13a9ea7 to 5db485e Compare September 15, 2025 16:40
content {
dynamic "elastic_load_balancing" {
for_each = local.auto_mode_enabled ? [1] : []
for_each = [var.compute_config]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach works also! Just an alternative way to do the same thing I was doing in #3513. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think you'll run into an error when var.compute_config == null, which is the default value for the variable. The construct that I used handles that scenario, var.compute_config[*].

Copy link
Contributor

@lorengordon lorengordon Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, that's why you had to change the default to {} and make it un-nullable. Of course that means the blocks will always be present now, even when not using auto mode.

enable_encryption_config = var.encryption_config != null && !local.create_outposts_local_cluster

auto_mode_enabled = try(var.compute_config.enabled, false)
create_auto_mode_iam_resources = var.compute_config.enabled || var.create_auto_mode_iam_resources
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can appreciate the logic behind having a separate var to create the auto mode iam resources. If that's the interface you wish to expose, then certainly makes sense.

Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bryantbiggs bryantbiggs merged commit 165d7c8 into master Sep 16, 2025
21 checks passed
antonbabenko pushed a commit that referenced this pull request Sep 16, 2025
## [21.3.0](v21.2.0...v21.3.0) (2025-09-16)

### Features

* Support EKS Auto Mode custom node pools only creation ([#3514](#3514)) ([165d7c8](165d7c8))
@antonbabenko
Copy link
Member

This PR is included in version 21.3.0 🎉

@bryantbiggs bryantbiggs deleted the feat/custom-node-pools branch September 16, 2025 13:50
Comment on lines +76 to +77
# Create just the IAM resources for EKS Auto Mode for use with custom node pools
create_auto_mode_iam_resources = true
Copy link
Contributor

@lorengordon lorengordon Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't quite enough. It is still necessary to enable auto mode, in order to use custom node pools with auto mode...

  compute_config = {
    enabled    = true
    node_pools = []
  }

@lorengordon
Copy link
Contributor

lorengordon commented Sep 16, 2025

The title here is not actually accurate. It was already possible to create a cluster with auto mode enabled, and configured to use only custom node pools. I've been doing it for months with this module. The enhancement I was working on in #3513 was to allow a user to switch between the built-in node pool configuration and custom node pool configuration, without error and without recreating the cluster.

@ayuris-liveramp
Copy link

My existing cluster is unable to use this new version:

# module.some_module.some_eks_cluster.this[0] will be updated in-place
  ~ resource "aws_eks_cluster" "this" {
        id                            = "some-eks-cluster"
        name                          = "some-eks-cluster"
        # (14 unchanged attributes hidden)

      + compute_config {
          + enabled = false
        }

      + storage_config {
          + block_storage {
              + enabled = false
            }
        }

        # (5 unchanged blocks hidden)
    }
Error: updating EKS Cluster compute config: operation error EKS: UpdateClusterConfig, https response error StatusCode: 400, InvalidRequestException: No changes needed for EKS Auto Mode configuration provided
eks cluster definition
module "eks" {
  source = "terraform-aws-modules/eks/aws"

  name               = var.vpc_module.eks.control_plane.cluster_name
  kubernetes_version = var.kubernetes_version

  enable_cluster_creator_admin_permissions = true
  endpoint_public_access                   = true
  endpoint_public_access_cidrs             = var.endpoint_public_access_cidrs

  addons = {
    coredns = {}
    eks-pod-identity-agent = {
      before_compute = true
    }
    kube-proxy = {}
    vpc-cni = {
      before_compute = true
    }
  }

  vpc_id                   = var.vpc_module.vpc.vpc_id
  subnet_ids               = var.vpc_module.vpc.private_subnets
  control_plane_subnet_ids = var.vpc_module.vpc.intra_subnets

  eks_managed_node_groups = {
    karpenter = {
      ami_type       = var.karpenter.ami_type
      instance_types = var.karpenter.instance_types
      min_size       = var.karpenter.min_size
      max_size       = var.karpenter.max_size
      desired_size   = var.karpenter.desired_size

      labels = {
        "karpenter.sh/controller" = "true"
      }
    }
  }

  access_entries = var.access_entries
}

@lorengordon
Copy link
Contributor

lorengordon commented Sep 16, 2025

@ayuris-liveramp Ahh. That's because the blocks are always present now...

#3514 (comment)

The approach in #3513 would have avoided that problem.

@bryantbiggs
Copy link
Member Author

The approach in #3513 would have avoided that problem.

No, no it would not. Any solution is susceptible to failure. Collecting details to share with the EKS service team. For now, pin your module version to v21.2.0

@lorengordon
Copy link
Contributor

The approach in #3513 would have avoided that problem.

No, no it would not. Any solution is susceptible to failure. Collecting details to share with the EKS service team. For now, pin your module version to v21.2.0

Yes, it actually did. I tested it. It worked because the logic on the dynamic blocks removed them from the config when compute_config was left at the default null value.

The only possible way to run into this error with that approach would be to create a cluster with auto mode enabled, then disable it by setting compute_config.enabled = false and apply, then set compute_config = null and apply again.

But the upgrade path for any existing cluster was just fine.

@marcusramberg
Copy link

I also had to pin as this upgrade broke our cluster with a half-completed terraform apply with the same error about No changes needed for EKS Auto Mode configuration provided - We've never had auto mode enabled.

@pdrastil
Copy link

Running into same issue. This is on US Gov cloud where EKS Auto Mode is not supported at all.

@bryantbiggs
Copy link
Member Author

AWS provider version v6.15.0 should be released tomorrow with the fix - we'll bump the MSV for the AWS provider here and release a new patch version which should resolve this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants